package com.jp.knowledge.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.jiayen.util.DisplayUtil;
import com.jp.knowledge.R;
import com.jp.knowledge.model.HeadLineData;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Locale;

/**
 * Created by 528787067@qq.com on 2017/6/14.
 */

public class VipZoneAdapter extends SecondLevelCommAdapter {

    public VipZoneAdapter(Context context, List infos) {
        super(context, infos, new SimpleDateFormat("MM月dd日", Locale.getDefault()));
    }

    @Override
    protected void renderData(JPRecycleViewHolder holder, Object item, int position) {
        super.renderData(holder, item, position);

        HeadLineData headLineData = (HeadLineData) item;
        TextView title = holder.getView(R.id.description);
        if(headLineData.getLayout() == 5){
            holder.getView(R.id.bottom_layout).setVisibility(View.GONE);
            holder.getView(R.id.desc_icon).setVisibility(View.GONE);
            title.setCompoundDrawablesWithIntrinsicBounds(R.mipmap.documentdirectory, 0, 0, 0);
            title.setCompoundDrawablePadding((int)mContext.getResources().getDimension(R.dimen.space_min));
            title.setPadding(0, (int)mContext.getResources().getDimension(R.dimen.space_big),
                    0, (int)mContext.getResources().getDimension(R.dimen.space_big));
            holder.getView(R.id.relevant_view).setVisibility(View.GONE);
            holder.getView(R.id.head_icon).setVisibility(View.GONE);
            holder.getView(R.id.desc_icon).setVisibility(View.GONE);
            holder.getView(R.id.muilt_icon).setVisibility(View.GONE);
            holder.getView(R.id.bottom_layout).setVisibility(View.GONE);
            holder.getView(R.id.relevant_text).setVisibility(View.GONE);
        } else{
            holder.getView(R.id.bottom_layout).setVisibility(View.VISIBLE);
            title.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
            title.setCompoundDrawablePadding(0);
            title.setPadding(0, 0, 0, 0);
        }
    }
}
